
$(function (){

	var rotateTimeOut = function (){

		$('#rotate').rotate({

			angle:0,

			animateTo:2160,

			duration:8000,

			callback:function (){

				alert('网络超时，请检查您的网络设置！');

			}

		});

	};

	var bRotate = false;



	var rotateFn = function (awards, angles, txt){

		bRotate = !bRotate;

		$('#rotate').stopRotate();

		$('#rotate').rotate({

			angle:0,

			animateTo:angles+1800,

			duration:8000,

			callback:function (){

				alert(txt);

				bRotate = !bRotate;

			}

		})

	};



	$('.pointer').click(function (){



		if(bRotate)return;

		var item = rnd(0,4);



		switch (item) {

			case 0:

				//var angle = [26, 88, 137, 185, 235, 287, 337];

				rotateFn(0, 30, '熙岸酒店20元优惠卷');

				break;

			case 1:

				//var angle = [88, 137, 185, 235, 287];

				rotateFn(1, 105, '未中奖');

				break;

			case 2:

				//var angle = [137, 185, 235, 287];

				rotateFn(2, 185, '熙岸酒店美颜家50元优惠卷');

				break;

			case 3:

				//var angle = [137, 185, 235, 287];

				rotateFn(3, 255, '熙岸酒店50元优惠卷');

				break;

			case 4:

				//var angle = [185, 235, 287];

				rotateFn(4, 320, '熙岸酒店免费女神房');

				break;

		}



		console.log(item);

	});

});

function rnd(n, m){

	return Math.floor(Math.random()*(m-n+1)+n)

}

